package com.winner.chain_of_responsibility_pattern;

import java.util.Random;
/**
 * 总经理
 */
public class GeneralManager extends Handler {
    public GeneralManager(String name) {
        super(name);
    }

    @Override
    public boolean process(LeaveRequest leaveRequest) {
        // 随机数大于3则为批准，否则不批准
        boolean result = (new Random().nextInt(10)) > 3;
        if (result == false) { // 总经理不批准
            return false;
        }
        // 总经理最后批准
        return true;
    }
}
